cmake_minimum_required (VERSION 2.8.11)
## Building Dynisnt 

## Dyninst libraries we need to link against
set(DYNINST_LIBRARY_COMMON  -lcommon)
set(DYNINST_LIBRARY_DYNC  -ldynC_API)
set(DYNINST_LIBRARY_DWARF  -ldynDwarf)
set(DYNINST_LIBRARY_ELF  -ldynElf)
set(DYNINST_LIBRARY_API_RT  -ldyninstAPI_RT)
set(DYNINST_LIBRARY_API  -ldyninstAPI)
set(DYNINST_LIBRARY_INSTAPI  -linstructionAPI)
set(DYNINST_LIBRARY_PARSE  -lparseAPI)
set(DYNINST_LIBRARY_PATCH  -lpatchAPI)
set(DYNINST_LIBRARY_PCONTROL  -lpcontrol)
set(DYNINST_LIBRARY_STACKWALK  -lstackwalk)
set(DYNINST_LIBRARY_SYMLITE  -lsymLite)
set(DYNINST_LIBRARY_SYMTAB  -lsymtabAPI)
set(DYNINST_TBB_LIBRARY -ltbbmalloc)

set(DYNINST_VERSION "HEAD")

## Check if existing dyninst install was passed
if (NOT DEFINED DYNINST_ROOT)
	message(ERROR "PLEASE SET -DDYNINST_ROOT=ROOT DIRECTORY FOR DYNINST")
endif(NOT DEFINED DYNINST_ROOT)
set(DYNINST_LIBRARY_DIR "-L${DYNINST_ROOT}/lib")
set(DYNINST_LIBRARIES "${DYNINST_LIBRARY_DIR} ${DYNINST_LIBRARY_COMMON} ${DYNINST_LIBRARY_DYNC} ${DYNINST_LIBRARY_DWARF} ${DYNINST_LIBRARY_ELF} ${DYNINST_LIBRARY_API_RT} ${DYNINST_LIBRARY_API} ${DYNINST_LIBRARY_INSTAPI} ${DYNINST_LIBRARY_PARSE} ${DYNINST_LIBRARY_PATCH} ${DYNINST_LIBRARY_PCONTROL} ${DYNINST_LIBRARY_STACKWALK} ${DYNINST_LIBRARY_SYMLITE} ${DYNINST_LIBRARY_SYMTAB} ${DYNINST_TBB_LIBRARY}")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
INCLUDE_DIRECTORIES("${DYNINST_ROOT}/include")
